$(function() {
    // 点击返回按钮返回上一页
    $(".goBack").bind("click", function() {
        // window.history.back();location.reload();	//强行刷新
        // window.history.go(-1);  //返回上一页
        window.location.href = document.referrer; //返回上一页并刷新
    });
    // 点击待付款跳转到待付款界面
    $(".order_ul .wait_pay").bind("click", function() {
        window.location.href = "waitPayOrder.html";
    });
    // 点击待发货跳转到待发货界面
    $(".order_ul .wait_deliver").bind("click", function() {
        window.location.href = "waitDeliverOrder.html";
    });
    // 点击待收货跳转到待收货界面
    $(".order_ul .wait_receipt").bind("click", function() {
        window.location.href = "waitReceiptOrder.html";
    });
    // 点击退换货跳转到退换货界面
    $(".order_ul .wait_return").bind("click", function() {
        window.location.href = "tuihuanhuoOrder.html";
    });
    // 确认弹框
    var sure = $('.confirm_cancel .text');

    // 获取零元购商城和集分商城的订单总页数
    var zeroPage = 0; 	// 零元购商城的订单总页数
    var jfscPage = 0; 	// 集分商城的订单总页数
    var flag1 = true;
    var flag2 = true;
	var zeroCode = 1;	// 零元购的code值
	var JfscCode = 1;	// 集分商城的code值
    // 获取零元购商城的订单页数
    function getZeroPage(a) {
        return zeroPage = a;
    }
    // 获取集分商城的订单页数
    function getJFSCPage(b) {
        return jfscPage = b;
    }
    // 比较集分商城和零元购商城订单页数最大值
    function compare(a,b){
        return a >= b ? a : b;
    }
    function Flag1(a){
        return flag1 = a;
    }
    function Flag2(a){
        return flag2 = a;
    }
    function getZeroCode(a){
		return zeroCode = a;
	}
	function getJfscCode(b){
		return JfscCode = b;
	}
    // 加载零元购商城和集分商城的订单
    dropload();
    function dropload() {
        var page = 0; // 页码数
        // dropload函数接口设置
        $('.goodOrder').dropload({
            scrollArea: window,
            // 上拉加载更多
            domDown: {
                domClass: 'dropload-down',
                // 滑动到底部显示内容
                domRefresh: '<div class="dropload-refresh">上拉加载更多</div>',
                // 内容加载过程中显示内容
                domLoad: '<div class="dropload-load"><span class="loading"></span>加载中...</div>',
                // 没有更多内容显示提示
                domNoData: '<div class="dropload-noData">我也是有深度的...</div>'
            },
            // 上拉加载更多 回调函数
            loadDownFn: function(me) {
                page++; // 每次请求，页码加1
                if(flag1){
                    var load1 = $.ajax({
                        type: 'GET',
                        url: 'http://a.91jfk.com/Product/Order/zero_index?p=' + page,
                        dataType: 'json',
                        success: function(res) {
                            console.log(res);
                            getZeroCode(res.code);
                            getZeroPage(res.totalpage);
                            // data = JSON.parse(res);
                            if (res.nowpage < res.totalpage) {
                                Flag1(true);
                                if (res.code == '1') {
                                    var data = res.msg;
                                    if (data.length > 0) {
                                        for (var i = 0; i < data.length; i++) {
                                            if (data[i].order_state == '取消订单') {
                                                zerodelateOrder(data[i].orderid,data[i].order_state,data[i].product,res.nowpage,data[i].product.length,data[i].total);
                                            } else if(data[i].order_state == '待付款'){
                                                zerowaitPay(data[i].orderid,data[i].order_state,data[i].product,res.nowpage,data[i].product.length,data[i].total);
                                            } else if(data[i].order_state == '待发货'){
                                                zerowaitDeliver(data[i].orderid,data[i].order_state,data[i].product,res.nowpage,data[i].is_barter,data[i].product.length,data[i].total);
                                            } else if(data[i].order_state == '待收货'){
                                                zerowaitReceipt(data[i].orderid,data[i].order_state,data[i].logistics_company,data[i].logistics_number,data[i].product,res.nowpage,data[i].product.length,data[i].total);
                                            } else if(data[i].order_state == '已签收'){
                                                zeroSigned(data[i].orderid,data[i].order_state,data[i].product,res.nowpage,data[i].product.length,data[i].total);
                                            } else if(data[i].order_state == '退换货申请'){
                                                zeroturnBack(data[i].orderid,data[i].order_state,data[i].product,res.nowpage,data[i].product.length,data[i].total);
                                            }
                                            $('img.lazy'+res.nowpage).lazyload({
                                                placeholder:"/Public/Product/img/loading2.gif",
                                                effect: "fadeIn",
                                                container: $(".allOrderList")
                                            });
                                        }
                                        if(data.length < 3){
                                            // 显示无数据
                                            me.noData();
                                            // 重置
                                            setTimeout(function() {
                                                me.resetload();
                                            }, 1500);
                                        }
                                    }
                                    setTimeout(function() {
                                        // 重置
                                        me.resetload();
                                    }, 1500);
                                    cancelORpay();      // 取消订单和付款
                                    lookORconfirm();    // 查看物流和确认收货，未签收订单
                                    remind();           // 提醒发货
                                    return_goods();     // 退换货
                                    deleteOrder();      // 删除订单
                                    look();             // 查看物流，已签收订单
                                    secondBuy();		// 再次购买
                                } else {
                                    me.noData();
                                    // 重置
                                    setTimeout(function() {
                                        me.resetload();
                                    }, 1500);
                                }
                            }else{
                                load1.abort();
                                Flag1(false);
                                if (res.code == '1') {
                                    var data = res.msg;
                                    for (var i = 0; i < data.length; i++) {
                                        if (data[i].order_state == '取消订单') {
                                            zerodelateOrder(data[i].orderid,data[i].order_state,data[i].product,res.nowpage,data[i].product.length,data[i].total);
                                        } else if(data[i].order_state == '待付款'){
                                            zerowaitPay(data[i].orderid,data[i].order_state,data[i].product,res.nowpage,data[i].product.length,data[i].total);
                                        } else if(data[i].order_state == '待发货'){
                                            zerowaitDeliver(data[i].orderid,data[i].order_state,data[i].product,res.nowpage,data[i].is_barter,data[i].product.length,data[i].total);
                                        } else if(data[i].order_state == '待收货'){
                                            zerowaitReceipt(data[i].orderid,data[i].order_state,data[i].logistics_company,data[i].logistics_number,data[i].product,res.nowpage,data[i].product.length,data[i].total);
                                        } else if(data[i].order_state == '已签收'){
                                            zeroSigned(data[i].orderid,data[i].order_state,data[i].product,res.nowpage,data[i].product.length,data[i].total);
                                        } else if(data[i].order_state == '退换货申请'){
                                            zeroturnBack(data[i].orderid,data[i].order_state,data[i].product,res.nowpage,data[i].product.length,data[i].total);
                                        }
                                        $('img.lazy'+res.nowpage).lazyload({
                                            placeholder:"/Public/Product/img/loading2.gif",
                                            effect: "fadeIn",
                                            container: $(".allOrderList")
                                        });
                                    }
                                    if(data.length < 3){
                                        // 显示无数据
                                        me.noData();
                                        // 重置
                                        setTimeout(function() {
                                            me.resetload();
                                        }, 1500);
                                    }
                                } else {
                                    me.noData();
                                    me.lock();
                                    // 重置
                                    setTimeout(function() {
                                        me.resetload();
                                    }, 1500);
                                }
                                cancelORpay();      // 取消订单和付款
                                lookORconfirm();    // 查看物流和确认收货，未签收订单
                                remind();           // 提醒发货
                                return_goods();     // 退换货
                                deleteOrder();      // 删除订单
                                look();             // 查看物流，已签收订单
                                secondBuy();		// 再次购买
                            }
                            // 重置
                            setTimeout(function() {
                                me.resetload();
                            }, 1500);
                        },
                        // 加载出错
                        error: function(err) {
                            console.log('Ajax error!');
                            // 即使加载出错，也得重置
                            setTimeout(function() {
                                me.resetload();
                            }, 1500);
                        }
                    });
                }else{
                    var max = compare(zeroPage,jfscPage);
                    if (page > max) {
                        // 再往下已经没有数据，锁定
                        // 显示无数据
                        me.noData();
                        me.lock();
                        // 重置
                        setTimeout(function() {
                            me.resetload();
                        }, 1500);
                    } else {
                        me.unlock();
                    }
                }
                if(flag2){
                    var load2 = $.ajax({
                        type: 'GET',
                        url: 'http://a.91jfk.com/Product/Ordershop/AllOrderData?p='+page,
                        dataType: 'json',
                        success: function(res) {
                            console.log(res);
                            getJfscCode(res.code);
                            getJFSCPage(res.total);
                            // data = JSON.parse(res);
                            if (res.nowpage < res.total) {
                                Flag2(true);
                                if (res.code == '1') {
                                    var data = res.message;
                                    if (data.length > 0) {
                                        for (var i = 0; i < data.length; i++) {
                                            if (data[i].order_state == '取消订单') {
                                                delateOrder(data[i].orderid,data[i].order_state,data[i].detail,res.nowpage,data[i].count,data[i].order_pay_price,data[i].order_pay_integral);
                                            } else if(data[i].order_state == '待付款'){
                                                waitPay(data[i].order_pay_price,data[i].order_pay_integral, data[i].orderid, data[i].order_state, data[i].detail,res.nowpage,data[i].count,data[i].order_pay_price,data[i].order_pay_integral);
                                            } else if(data[i].order_state == '待发货'){
                                                waitDeliver(data[i].orderid,data[i].order_state,data[i].detail,res.nowpage,data[i].is_barter,data[i].count,data[i].order_pay_price,data[i].order_pay_integral);
                                            } else if(data[i].order_state == '待收货'){
                                                waitReceipt(data[i].orderid,data[i].order_state,data[i].logistics_company,data[i].logistics_number,data[i].detail,res.nowpage,data[i].count,data[i].order_pay_price,data[i].order_pay_integral);
                                            } else if(data[i].order_state == '已签收'){
                                                signed(data[i].orderid,data[i].order_state,data[i].detail,res.nowpage,data[i].count,data[i].order_pay_price,data[i].order_pay_integral);
                                            } else if(data[i].order_state == '退换货申请'){
                                                turnBack(data[i].orderid,data[i].order_state,data[i].detail,res.nowpage,data[i].count,data[i].order_pay_price,data[i].order_pay_integral);
                                            }
                                            $('img.lazy'+res.nowpage).lazyload({
                                                placeholder:"/Public/Product/img/loading2.gif",
                                                effect: "fadeIn",
                                                container: $(".allOrderList")
                                            });
                                        }
                                        if(data.length < 3){
                                            // 显示无数据
                                            me.noData();
                                            // 重置
                                            setTimeout(function() {
                                                me.resetload();
                                            }, 1500);
                                        }
                                    }
                                    setTimeout(function() {
                                        // 重置
                                        me.resetload();
                                    }, 1500);
                                    cancelORpay();      // 取消订单和付款
                                    lookORconfirm();    // 查看物流和确认收货，未签收订单
                                    remind();           // 提醒发货
                                    return_goods();     // 退换货
                                    deleteOrder();      // 删除订单
                                    look();             // 查看物流，已签收订单
                                    secondBuy();		// 再次购买
                                } else {
                                    me.noData();
                                    // 重置
                                    setTimeout(function() {
                                        me.resetload();
                                    }, 1500);
                                }
                            }else{
                                load2.abort();
                                Flag2(false);
                                if (res.code == '1') {
                                    var data = res.message;
                                    for (var i = 0; i < data.length; i++) {
                                        if (data[i].order_state == '取消订单') {
                                            delateOrder(data[i].orderid,data[i].order_state,data[i].detail,res.nowpage,data[i].count,data[i].order_pay_price,data[i].order_pay_integral);
                                        } else if(data[i].order_state == '待付款'){
                                            waitPay(data[i].order_pay_price,data[i].order_pay_integral, data[i].orderid, data[i].order_state, data[i].detail,res.nowpage, data[i].count, data[i].order_pay_price, data[i].order_pay_integral);
                                        } else if(data[i].order_state == '待发货'){
                                            waitDeliver(data[i].orderid,data[i].order_state,data[i].detail,res.nowpage,data[i].is_barter,data[i].count,data[i].order_pay_price,data[i].order_pay_integral);
                                        } else if(data[i].order_state == '待收货'){
                                            waitReceipt(data[i].orderid,data[i].order_state,data[i].logistics_company,data[i].logistics_number,data[i].detail,res.nowpage,data[i].count,data[i].order_pay_price,data[i].order_pay_integral);
                                        } else if(data[i].order_state == '已签收'){
                                            signed(data[i].orderid,data[i].order_state,data[i].detail,res.nowpage,data[i].count,data[i].order_pay_price,data[i].order_pay_integral);
                                        } else if(data[i].order_state == '退换货申请'){
                                            turnBack(data[i].orderid,data[i].order_state,data[i].detail,res.nowpage,data[i].count,data[i].order_pay_price,data[i].order_pay_integral);
                                        }
                                        $('img.lazy'+res.nowpage).lazyload({
                                            placeholder:"/Public/Product/img/loading2.gif",
                                            effect: "fadeIn",
                                            container: $(".allOrderList")
                                        });
                                    }
                                    if(data.length < 3){
                                        // 显示无数据
                                        me.noData();
                                        // 重置
                                        setTimeout(function() {
                                            me.resetload();
                                        }, 1500);
                                    }
                                } else {
                                    me.noData();
                                    me.lock();
                                    // 重置
                                    setTimeout(function() {
                                        me.resetload();
                                    }, 1500);
                                }
                            }
                            setTimeout(function() {
                                me.resetload();
                            }, 1500);
                            cancelORpay();      // 取消订单和付款
                            lookORconfirm();    // 查看物流和确认收货，未签收订单
                            remind();           // 提醒发货
                            return_goods();     // 退换货
                            deleteOrder();      // 删除订单
                            look();             // 查看物流，已签收订单
                            secondBuy();		// 再次购买
                        },
                        // 加载出错
                        error: function(err) {
                            console.log('Ajax error!');
                            console.log(err);
                            // 即使加载出错，也得重置
                            setTimeout(function() {
                                me.resetload();
                            }, 1500);
                        }
                    });
                }else{
                    var max = compare(zeroPage,jfscPage);
                    if (page > max) {
                        // 再往下已经没有数据  锁定
                        // 显示无数据
                        me.noData();
                        me.lock();
                        // 重置
                        setTimeout(function() {
                            me.resetload();
                        }, 1500);
                    } else {
                        me.unlock();
                    }
                }
            }
        });
    }
    setTimeout(function(){
		if (zeroCode == 0 && JfscCode == 0) {
			$('.no_order').show();
			$('.no_order .img2').bind('click',function(){
				window.location.href = 'http://a.91jfk.com/Product/Pointshop/point_shop_index.html'
			});
            setTimeout(function(){
                $('div.dropload-noData').fadeOut(1000);
            },200);
		} else{
			$('.kong').hide();
		}
	},1500);

    /*参数
     * orderNum		订单编号
     * state		订单状态
     * src			商品图片地址
     * title		商品名称
     * price		商品单价
     * states		商品交易状态
     * count		单件商品的数量
     * num			单笔订单里的商品总数
     * total		单笔订单的总价
     * arr			多个商品数组
     */
    //待付款订单
    function zerowaitPay(orderNum, state, arr, j, num, total) {
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        var list_top = $('<div class="orderList_num"><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
        listBox.append(list_top);
        for (var i = 0; i < arr.length; i++) {
            var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].thumbnail + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].title + '</span><span class="red price">&yen;' + arr[i].price + '</span></p><p class="p_bot"><span class="red count">x' + arr[i].num + '</span></p></div></div>');
            listBox.append(list_con);
        }
        var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total + '元</span>(含运费&yen;3.0)</p><button class="payment fr">付款</button><button class="cancelOrder fr">取消订单</button></div>');
        var $el = listBox.append(list_bot);
        List.append($el);
    }

    //待发货
    function zerowaitDeliver(orderNum, state, arr, j, is, num, total) {
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        var list_top = $('<div class="orderList_num"><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
        listBox.append(list_top);
        for (var i = 0; i < arr.length; i++) {
            var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].thumbnail + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].title + '</span><span class="red price">&yen;' + arr[i].price + '</span></p><p class="p_bot"><span class="red count">x' + arr[i].num + '</span></p></div></div>');
            listBox.append(list_con);
        }
        if (is == '1') {
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total + '元</span>(含运费&yen;3.0)</p><button class="alreadyRemind fr">已提醒发货</button></div>');
            var $el = listBox.append(list_bot);
            List.append($el);
        } else if(is == '2'){
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total + '元</span>(含运费&yen;3.0)</p><button class="remindDer fr">提醒发货</button></div>');
            var $el = listBox.append(list_bot);
            List.append($el);
        }
    }

    //待收货
    function zerowaitReceipt(orderNum, state, wuliuCpy, wuliuNum, arr, j, num, total) {
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        var list_top = $('<div class="orderList_num"><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span><input type="hidden" class="input1" value="' +wuliuCpy + '"><input type="hidden" class="input2" value="' +wuliuNum + '"></div>');
        listBox.append(list_top);
        for (var i = 0; i < arr.length; i++) {
            var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].thumbnail + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].title + '</span><span class="red price">&yen;' + arr[i].price + '</span></p><p class="p_bot"><span class="red count">x' + arr[i].num + '</span></p></div></div>');
            listBox.append(list_con);
        }
        var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total + '元</span>(含运费&yen;3.0)</p><button class="confirmGet">确认收货</button><button class="seeExpress delivery fr">查看物流</button></div>');
        var $el = listBox.append(list_bot);
        List.append($el);
    }

    //已签收
    function zeroSigned(orderNum, state, arr, j, num, total) {
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        var list_top = $('<div class="orderList_num"><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
        listBox.append(list_top);
        for (var i = 0; i < arr.length; i++) {
            var list_con = $('<div class="orderList_con"><input type="hidden" class="input1" value="' + arr[i].pid + '"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].thumbnail + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].title + '</span><span class="red price">&yen;' + arr[i].price + '</span></p><p class="p_bot"><span class="red count">x' + arr[i].num + '</span></p></div></div>');
            listBox.append(list_con);
        }
        var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total + '元</span>(含运费&yen;3.0)</p><button class="seeExpress secondBuy fr">再次购买</button></div>');
        var $el = listBox.append(list_bot);
        List.append($el);
    }

    //退换货
    function zeroturnBack(orderNum, state, arr, j, num, total) {
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        var list_top = $('<div class="orderList_num"><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
        listBox.append(list_top);
        for (var i = 0; i < arr.length; i++) {
            var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].thumbnail + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].title + '</span><span class="red price">&yen;' + arr[i].price + '</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].states + '</span><button class="return_goods">申请退货</button><span class="red count">x' + arr[i].count + '</span></p></div></div>');
            listBox.append(list_con);
        }
        var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total + '元</span>(含运费&yen;3.0)</p><button class="return_goods fr">申请退货</button></div>');
        var $el = listBox.append(list_bot);
        List.append($el);
    }

    // 取消订单
    function zerodelateOrder(orderNum, state, arr, j, num, total) {
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        var list_top = $('<div class="orderList_num"><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
        listBox.append(list_top);
        for (var i = 0; i < arr.length; i++) {
            var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].thumbnail + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].title + '</span><span class="red price">&yen;' + arr[i].price + '</span></p><p class="p_bot"><span class="red count">x' + arr[i].num + '</span></p></div></div>');
            listBox.append(list_con);
        }
        var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total + '元</span>(含运费&yen;3.0)</p><button class="delete fr">删除订单</button></div>');
        var $el = listBox.append(list_bot);
        List.append($el);
    }

    //待付款订单
    function waitPay(amount1, amount2, orderNum, state, arr, j, num, total1, total2) {    //total1现金总价格,total2集分总价格
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        if (amount1 != '0.00' && amount2 == '0') {     // 纯现金   value = 3
            var list_top = $('<div class="orderList_num"><input type="hidden" value="3" /><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
            listBox.append(list_top);
        } else if (amount1 == '0.00' && amount2 != '0'){   // 纯集分  value = 1
            var list_top = $('<div class="orderList_num"><input type="hidden" value="1" /><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
            listBox.append(list_top);
        } else if (amount1 != '0.00' && amount2 != '0'){   // 现金加集分    value = 2
            var list_top = $('<div class="orderList_num"><input type="hidden" value="2" /><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
            listBox.append(list_top);
        }
        for (var i = 0; i < arr.length; i++) {  //point_price集分价格 cash_price现金价格
            if (arr[i].cash_price == '0.00' && arr[i].point_price != '0') {   //纯集分商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].point_price + '集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            }else if(arr[i].cash_price != '0.00' && arr[i].point_price != '0'){    //集分加现金商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].cash_price + '元+' + arr[i].point_price + '集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            } else if(arr[i].cash_price != '0.00' && arr[i].point_price == '0'){   //纯现金商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].cash_price + '元</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            }
        }
        if (total1 != '0.00' && total2 == '0') {     //纯现金商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元</span>(含运费&yen;3.0)</p><button class="payment fr">付款</button><button class="cancelOrder fr">取消订单</button></div>');
            var $el = listBox.append(list_bot);
        }else if(total1 == '0.00' && total2 != '0'){     //纯集分商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total2 + '集分</span>(含运费&yen;3.0)</p><button class="payment fr">付款</button><button class="cancelOrder fr">取消订单</button></div>');
            var $el = listBox.append(list_bot);
        } else if(total1 != '0.00' && total2 != '0'){    //集分加现金商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元+' + total2 +'集分</span>(含运费&yen;3.0)</p><button class="payment fr">付款</button><button class="cancelOrder fr">取消订单</button></div>');
            var $el = listBox.append(list_bot);
        } else {    //集分加现金商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total2 +'集分</span>(含运费&yen;3.0)</p><button class="payment fr">付款</button><button class="cancelOrder fr">取消订单</button></div>');
            var $el = listBox.append(list_bot);
        }
        List.append($el);
    }

    //待发货，已付款
    function waitDeliver(orderNum, state, arr, j, is, num, total1, total2) {
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        var list_top = $('<div class="orderList_num"><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
        listBox.append(list_top);
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].cash_price == '0.00' && arr[i].point_price != '0') {   //纯集分商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].point_price + '集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            }else if(arr[i].cash_price != '0.00' && arr[i].point_price != '0'){    //集分加现金商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].cash_price + '元+' + arr[i].point_price + '集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            } else if(arr[i].cash_price != '0.00' && arr[i].point_price == '0'){   //纯现金商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].cash_price + '元</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            }
        }
        if (total1 != '0.00' && total2 == '0') {     // 纯现金商品
            if (is == '1') {
                var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元</span>(含运费&yen;3.0)</p><button class="alreadyRemind fr">已提醒发货</button></div>');
                var $el = listBox.append(list_bot);
            } else if(is == '2'){
                var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元</span>(含运费&yen;3.0)</p><button class="remindDer fr">提醒发货</button></div>');
                var $el = listBox.append(list_bot);
            }
        }else if(total1 == '0.00' && total2 != '0'){     // 纯集分商品
            if (is == '1') {                             // 已提醒发货
                var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total2 + '集分</span>(含运费&yen;3.0)</p><button class="alreadyRemind fr">已提醒发货</button></div>');
                var $el = listBox.append(list_bot);
            } else if(is == '2'){                        // 未提醒发货
                var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total2 + '集分</span>(含运费&yen;3.0)</p><button class="remindDer fr">提醒发货</button></div>');
                var $el = listBox.append(list_bot);
            }
        } else if(total1 != '0.00' && total2 != '0'){    // 集分加现金商品
            if (is == '1') {
                var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元+' + total2 +'集分</span>(含运费&yen;3.0)</p><button class="alreadyRemind fr">已提醒发货</button></div>');
                var $el = listBox.append(list_bot);
            } else if(is == '2'){
                var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元+' + total2 +'集分</span>(含运费&yen;3.0)</p><button class="remindDer fr">提醒发货</button></div>');
                var $el = listBox.append(list_bot);
            }
        }
        List.append($el);
    }

    //待收货
    function waitReceipt(orderNum, state, wuliuCpy, wuliuNum, arr, j, num, total1,total2) {
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        var list_top = $('<div class="orderList_num"><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span><input type="hidden" class="input1" value="' +wuliuCpy + '"><input type="hidden" class="input2" value="' +wuliuNum + '"></div>');
        listBox.append(list_top);
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].cash_price == '0.00' && arr[i].point_price != '0') {   //纯集分商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].point_price + '集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            }else if(arr[i].cash_price != '0.00' && arr[i].point_price != '0'){    //集分加现金商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].cash_price + '元+' + arr[i].point_price + '集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            } else if(arr[i].cash_price != '0.00' && arr[i].point_price == '0'){   //纯现金商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].cash_price + '元</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            }
        }
        if (total1 != '0.00' && total2 == '0') {     //纯现金商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元</span>(含运费&yen;3.0)</p><button class="confirmGet fr">确认收货</button><button class="seeExpress delivery fr">查看物流</button></div>');
            var $el = listBox.append(list_bot);
        }else if(total1 == '0.00' && total2 != '0'){     //纯集分商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total2 + '集分</span>(含运费&yen;3.0)</p><button class="confirmGet fr">确认收货</button><button class="seeExpress delivery fr">查看物流</button></div>');
            var $el = listBox.append(list_bot);
        } else if(total1 != '0.00' && total2 != '0'){    //集分加现金商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元+' + total2 +'集分</span>(含运费&yen;3.0)</p><button class="confirmGet fr">确认收货</button><button class="seeExpress delivery fr">查看物流</button></div>');
            var $el = listBox.append(list_bot);
        }
        List.append($el);
    }

    //已签收
    function signed(orderNum, state, arr, j, num, total1,total2) {
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        var list_top = $('<div class="orderList_num"><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
        listBox.append(list_top);
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].cash_price == '0.00' && arr[i].point_price != '0') {   //纯集分商品
                var list_con = $('<div class="orderList_con"><input type="hidden" class="input1" value="' + arr[i].id + '"><input type="hidden" class="input2" value="' + arr[i].skuid + '"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].point_price + '集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            }else if(arr[i].cash_price != '0.00' && arr[i].point_price != '0'){    //集分加现金商品
                var list_con = $('<div class="orderList_con"><input type="hidden" class="input1" value="' + arr[i].id + '"><input type="hidden" class="input2" value="' + arr[i].skuid + '"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].cash_price + '元+' + arr[i].point_price + '集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            } else if(arr[i].cash_price != '0.00' && arr[i].point_price == '0'){   //纯现金商品
                var list_con = $('<div class="orderList_con"><input type="hidden" class="input1" value="' + arr[i].id + '"><input type="hidden" class="input2" value="' + arr[i].skuid + '"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].cash_price + '元</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            }
        }
        if (total1 != '0.00' && total2 == '0') {     //纯现金商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元</span>(含运费&yen;3.0)</p><button class="seeExpress secondBuy fr">再次购买</button><input type="hidden" class="inputType" value="1"></div>');
            var $el = listBox.append(list_bot);
        }else if(total1 == '0.00' && total2 != '0'){     //纯集分商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total2 + '集分</span>(含运费&yen;3.0)</p><button class="seeExpress secondBuy fr">再次购买</button><input type="hidden" class="inputType" value="3"></div>');
            var $el = listBox.append(list_bot);
        } else if(total1 != '0.00' && total2 != '0'){    //集分加现金商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元+' + total2 +'集分</span>(含运费&yen;3.0)</p><button class="seeExpress secondBuy fr">再次购买</button><input type="hidden" class="inputType" value="2"></div>');
            var $el = listBox.append(list_bot);
        }
        List.append($el);
    }

    //退换货
    function turnBack(orderNum, state, arr, j, num, total1, total2) {
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        var list_top = $('<div class="orderList_num"><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
        listBox.append(list_top);
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].cash_price == '0.00' && arr[i].point_price != '0') {   //纯集分商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div><span class="branchid">' + arr[i].branchid + '</span></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;<n>' + arr[i].point_price + '</n>集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x<m>' + arr[i].purchase_num + '</m></span></p><button class="return_goods">申请退货</button></div></div>');
                listBox.append(list_con);
            }else if(arr[i].cash_price != '0.00' && arr[i].point_price != '0'){    //集分加现金商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div><span class="branchid">' + arr[i].branchid + '</span></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;<m>' + arr[i].cash_price + '</m>元+<n>' + arr[i].point_price + '</n>集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x<m>' + arr[i].purchase_num + '</m></span></p><button class="return_goods">申请退货</button></div></div>');
                listBox.append(list_con);
            } else if(arr[i].cash_price != '0.00' && arr[i].point_price == '0'){   //纯现金商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div><span class="branchid">' + arr[i].branchid + '</span></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;<m>' + arr[i].cash_price + '</m>元</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x<m>' + arr[i].purchase_num + '</m></span></p><button class="return_goods">申请退货</button></div></div>');
                listBox.append(list_con);
            }
        }
        if (total1 != '0.00' && total2 == '0') {     //纯现金商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元</span>(含运费&yen;3.0)</p></div>');
            var $el = listBox.append(list_bot);
        }else if(total1 == '0.00' && total2 != '0'){     //纯集分商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total2 + '集分</span>(含运费&yen;3.0)</p></div>');
            var $el = listBox.append(list_bot);
        } else if(total1 != '0.00' && total2 != '0'){    //集分加现金商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元+' + total2 +'集分</span>(含运费&yen;3.0)</p></div>');
            var $el = listBox.append(list_bot);
        }
        List.append($el);
    }

    // 取消订单
    function delateOrder(orderNum, state, arr, j, num, total1,total2) {
        var List = $('.allOrderList');
        var listBox = $('<div class="orderList_box"></div>');
        var list_top = $('<div class="orderList_num"><span>订单编号：</span><span class="orderNum">' + orderNum + '</span><span class="TrsnState">' + state + '</span></div>');
        listBox.append(list_top);
        for (var i = 0; i < arr.length; i++) {
            if (arr[i].cash_price == '0.00' && arr[i].point_price != '0') {   //纯集分商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].point_price + '集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            }else if(arr[i].cash_price != '0.00' && arr[i].point_price != '0'){    //集分加现金商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].cash_price + '元+' + arr[i].point_price + '集分</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            } else if(arr[i].cash_price != '0.00' && arr[i].point_price == '0'){   //纯现金商品
                var list_con = $('<div class="orderList_con"><div class="orderList_con_lt"><div class="lt_imgBox"><img class="IMG lazy'+ j +'" src="/Public/Product/img/loading2.gif" data-original="' + arr[i].show_pic + '" alt="" /></div></div><div class="orderList_con_rt"><p class="p_top"><span class="goodTitle">' + arr[i].pname + '</span><span class="red price">&yen;' + arr[i].cash_price + '元</span></p><p class="p_bot"><span class="sucesORfail">' + arr[i].shuxing_zhi.replace(/'/g,'') + '</span><span class="red count">x' + arr[i].purchase_num + '</span></p></div></div>');
                listBox.append(list_con);
            }
        }
        if (total1 != '0.00' && total2 == '0') {     //纯现金商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元</span>(含运费&yen;3.0)</p><button class="delete fr">删除订单</button></div>');
            var $el = listBox.append(list_bot);
        }else if(total1 == '0.00' && total2 != '0'){     //纯集分商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total2 + '集分</span>(含运费&yen;3.0)</p><button class="delete fr">删除订单</button></div>');
            var $el = listBox.append(list_bot);
        } else if(total1 != '0.00' && total2 != '0'){    //集分加现金商品
            var list_bot = $('<div class="orderList_bot"><p class="num-money">共<span class="good_piece pur">' + num + '</span>件商品，合计：&yen;<span class="allPrice pur">' + total1 + '元+' + total2 +'集分</span>(含运费&yen;3.0)</p><button class="delete fr">删除订单</button></div>');
            var $el = listBox.append(list_bot);
        }
        List.append($el);
    }

    //点击订单获取订单号，跳转订单详情页
    $(document).delegate('.orderList_box', 'click', function() {
        var orderNum = $(this).find(".orderNum").text();
        console.log(orderNum);
        window.location.href = 'orderDetail.html?orderid=' + orderNum;
    });

    //取消订单和支付
    function cancelORpay() {
        //点击取消订单按钮的事件，首先阻止事件冒泡
        $('.orderList_box').off('click', '.cancelOrder').on('click', '.cancelOrder', function(e) {
            $('.confirm_cancel').find('.text').text('确认取消这笔订单吗？');
            var evt = e || window.event; //兼容IE
            evt.stopPropagation();
            $('html,body').addClass('ovfHiden');
            //console.log("已经阻止事件冒泡");
            var OdNum = $(this).parents(".orderList_box").children(".orderList_num").children(".orderNum").text();
            console.log(OdNum);
            $('.mask').show();
            //阻止弹窗出来以后还可以滚动
            $('.mask,.confirm_cancel').bind("touchmove", function(e) {
                e.preventDefault();
            });
            $('.confirm_cancel').show().find('.sure').unbind('click').bind('click',function(){
                if (OdNum.substring(0,1) == 'Z') {
                    $.ajax({
                        url:"http://a.91jfk.com/Product/Order/order_cancel",
                        type:"post",
                        data:{
                            orderid:OdNum
                        },
                        dataType:'json',
                        success:function(res){
                            console.log(res);
                            if (res.code == '1') {
                                $('.confirm_cancel').hide();
                                $('.mask').hide();
                                $('.errAlert').addClass('AlertShow').text(res.msg);
                                setTimeout(function(){
                                    $('.errAlert').removeClass('AlertShow');
                                    window.location.reload();
                                },1500);
                            }
                        },
                        error:function(err){
                            console.log(err);
                        }
                    });
                } else if(OdNum.substring(0,1) == 'J'){
                    $.ajax({
                        url:"http://a.91jfk.com/Product/Ordershop/CancleOrder",
                        type:"post",
                        data:{
                            orderid:OdNum
                        },
                        dataType:'json',
                        success:function(res){
                            console.log(res);
                            $('.confirm_cancel').hide();
                            $('.mask').hide();
                            $('.errAlert').addClass('AlertShow').text(res.message);
                            setTimeout(function(){
                                $('.errAlert').removeClass('AlertShow');
                                window.location.reload();
                            },1500);
                        },
                        error:function(err){
                            console.log(err);
                        }
                    });
                }
            });
        });
        //点击付款按钮的事件，首先阻止事件冒泡
        var info_total = $('.info_price');      // 确认信息框的总金额
        var point = $('#pointPay');             // 纯集分支付弹框
        $('.orderList_box').off('click', '.orderList_bot .payment').on('click', '.orderList_bot .payment', function(e) {
            var evt = e || window.event; // 兼容IE
            evt.stopPropagation();  // 阻止事件冒泡
            var OdNum = $(this).parents(".orderList_box").children(".orderList_num").children(".orderNum").text(); // 获取订单号码
            console.log(OdNum);
            var total = $(this).parents(".orderList_box").find(".allPrice").text();    // 储存应该付款的金额
            console.log(total);
            //点击圆圈选择支付方式
            var payWay; // 用于记录支付方式
            if (OdNum.substring(0,1) == 'Z') {
                $('.mask').show();                      // 蒙版
                $('.payment_foot').show();              // 支付弹窗
                evt.stopPropagation();                  // 阻止事件冒泡
                $('html,body').addClass('ovfHiden');    // 阻止弹框弹出以后页面继续滚动
                info_total.text(total);
                $('.mode_row').unbind('click').bind('click', function() {
                    $(this).children('.row_Rt').find('.pur').addClass('addCir');
                    $(this).siblings().children('.row_Rt').find('.pur').removeClass('addCir');
                    var payWay = $(this).children('input[type=hidden]').val();
                    console.log(payWay);
                    // payWay = $(this).children('.row_con').find('.mode_name').text();
                    // 点击确认支付，发送支付请求
                    $('.confirm_cfm').unbind('click').bind('click', function() {
                        if (payWay == '1') {
                            console.log('微信支付');
                            $.ajax({
                                url: "http://a.91jfk.com/Product/WxJsAPI/jsApiCall",
                                type: "post",
                                data: {
                                    orderId: OdNum
                                },
                                datatype: "json",
                                success: function(xhr) {
                                    console.log(xhr);
                                    var data = JSON.parse(xhr);
                                    callpay(data.jsApiParameters);
                                },
                                error: function(mes) {
                                    console.log('支付失败');
                                }
                            });//ajax结束
                        } else if(payWay == '2'){
                            console.log('2')
                        }
                    });
                });
            } else if(OdNum.substring(0,1) == 'J'){ 
                //1、纯集分 2、集分加现金 3、纯现金
                var goodType = $(this).parents(".orderList_box").children('.orderList_num').children('input[type=hidden]').val();  
                console.log(goodType);
                if (goodType == 1 || goodType == 2) {   //纯集分或集分加现金商品，先判断积分是否充足
                    $.ajax({
                        type:"post",
                        url:"http://a.91jfk.com/Product/Pointorder/JudgePoint",
                        data:{
                            orderid:OdNum
                        },
                        dataType:'json',
                        success:function(res){
                            console.log(res);
                            if (res.code == 1) {                  
                                if (goodType == 2) {                            // 集分加现金，前端只显示扣除的现金
                                    var strs = new Array();                     // 定义数组 
                                    strs = total.split("+");                    // 字符分割
                                    var point = strs[1].replace(/[^0-9]/ig,"");
                                    console.log(point); 
                                    if ((point - 0) <= (res.num - 0)) {         // 集分充足，可以支付
                                        $('.mask').show();                      // 蒙版
                                        $('.payment_foot').show();              // 支付弹窗
                                        evt.stopPropagation();                  // 阻止事件冒泡
                                        $('html,body').addClass('ovfHiden');    // 阻止弹框弹出以后页面继续滚动
                                        info_total.text(total);
                                        $('.mode_row').unbind('click').bind('click', function() {
                                            $(this).children('.row_Rt').find('.pur').addClass('addCir');
                                            $(this).siblings().children('.row_Rt').find('.pur').removeClass('addCir');
                                            var payWay = $(this).children('input[type=hidden]').val();
                                            console.log(payWay);
                                            // payWay = $(this).children('.row_con').find('.mode_name').text();
                                            // 点击确认支付，发送支付请求
                                            $('.confirm_cfm').unbind('click').bind('click', function() {
                                                if (payWay == '1') {
                                                    console.log('微信支付');
                                                    $.ajax({
                                                        url: "http://a.91jfk.com/Product/WxJsAPI/jsApiCall",
                                                        type: "post",
                                                        data: {
                                                            orderId: OdNum
                                                        },
                                                        datatype: "json",
                                                        success: function(xhr) {
                                                            console.log(xhr);
                                                            var data = JSON.parse(xhr);
                                                            callpay(data.jsApiParameters);
                                                        },
                                                        error: function(mes) {
                                                            console.log('支付失败');
                                                        }
                                                    });//ajax结束
                                                } else if(payWay == '2'){
                                                    console.log('2')
                                                }
                                            });
                                        });
                                    } else {
                                        $(".errAlert").text(res.message).addClass("AlertShow");
                                        setTimeout(function(){
                                            $(".errAlert").removeClass("AlertShow");
                                        },1500);
                                    }   
                                }
                                if (goodType == 1) {     //纯集分商品  显示账户总积分和商品所需积分
                                    var point1 = total.replace(/[^0-9]/ig,"");
                                    console.log(parseInt(point1));
                                    console.log(parseInt(res.num - 0));
                                    if ((point1 - 0) <= (res.num - 0)) {
                                        $('.mask').css('display','block');
                                        $('#pointPay').show().children('#pointPay_top').children('.formHoutai').text(res.num).siblings('.formCount').text(point1).parents('#pointPay').find('#point_sure').click("click",function(){	
                                            $.ajax({
                                                url:"http://a.91jfk.com/Product/Nowbuy/des_num",
                                                type:"post",
                                                data:{
                                                    orderid:OdNum
                                                },
                                                dataType:'json',
                                                success:function(res){
                                                    console.log(res);
                                                    $(".errAlert").text(res.message).addClass("AlertShow");
                                                    setTimeout(function(){
                                                        window.location.reload();
                                                        $(".errAlert").removeClass("AlertShow");
                                                    },1500);
                                                    $('.mask').hide();
                                                    $('#pointPay').hide();
                                                },
                                                error:function(err){
                                                    console.log(err);
                                                }
                                            });
                                        });
                                    } else {
                                        $(".errAlert").text(res.message).addClass("AlertShow");
                                        setTimeout(function(){
                                            $(".errAlert").removeClass("AlertShow");
                                        },1500);
                                    }
                                }
                            }else{
                                $(".errAlert").text(res.message).addClass("AlertShow");
                                setTimeout(function(){
                                    $(".errAlert").removeClass("AlertShow");
                                },1500);
                            }
                        },
                        error:function(err){
                            console.log(err);
                        }
                    });
                } else if(goodType == 3){                   // 纯现金商品
                    $('.mask').show();                      // 蒙版
                    $('.payment_foot').show();              // 支付弹窗
                    evt.stopPropagation();                  // 阻止事件冒泡
                    $('html,body').addClass('ovfHiden');    // 阻止弹框弹出以后页面继续滚动
                    info_total.text(total);                 // 支付信息弹框显示总金额
                    $('.mode_row').unbind('click').bind('click', function() {
                        $(this).children('.row_Rt').find('.pur').addClass('addCir');
                        $(this).siblings().children('.row_Rt').find('.pur').removeClass('addCir');
                        var payWay = $(this).children('input[type=hidden]').val();
                        console.log(payWay);
                        // payWay = $(this).children('.row_con').find('.mode_name').text();
                        // 点击确认支付，发送支付请求
                        $('.confirm_cfm').unbind('click').bind('click', function() {
                            if (payWay == '1') {
                                console.log('微信支付');
                                $.ajax({
                                    url: "http://a.91jfk.com/Product/WxJsAPI/jsApiCall",
                                    type: "post",
                                    data: {
                                        orderId: OdNum
                                    },
                                    datatype: "json",
                                    success: function(xhr) {
                                        console.log(xhr);
                                        var data = JSON.parse(xhr);
                                        callpay(data.jsApiParameters);
                                    },
                                    error: function(err) {
                                        console.log('支付失败');
                                    }
                                });// ajax结束
                            } else if(payWay == '2'){
                                console.log('连连支付');
                                //window.location.href = '';
                            } else{
                                $(".errAlert").text("请选择付款方式...").addClass("AlertShow");
                                setTimeout(function(){
                                    $(".errAlert").removeClass("AlertShow");
                                },1500);
                            }
                        });
                    });
                }
            }
        });
    }

    //纯集分支付、取消支付
    $('#point_cancel').click(function(){
    	$('.mask').hide();
        $('#pointPay').hide();
        window.location.reload();
    });

    //提醒发货
    var remindBtn = $('.remindDer');    //提醒发货按钮
    function remind(){
        //点击提醒发货按钮的事件，首先阻止事件冒泡 
        $('.orderList_bot').off('click','.remindDer').on('click','.remindDer', function(e) {
            var evt = e || window.event;    // 兼容IE
            evt.stopPropagation();          // 阻止时间冒泡
            var OdNum = $(this).parents(".orderList_box").find(".orderNum").text();
            console.log(OdNum);
            $.ajax({
                url:"http://a.91jfk.com/Product/Order/barter",
                type:"post",
                data:{
                    orderid:OdNum
                },
                dataType:'json',
                success:function(res){
                    $('.errAlert').addClass('AlertShow').text(res.msg);
                    setTimeout(function(){
                        $('.errAlert').removeClass('AlertShow');
                        window.location.reload();
                    },1500);
                },
                error:function(err){
                    $('.errAlert').addClass('AlertShow').text(res.msg);
                    setTimeout(function(){
                        $('.errAlert').removeClass('AlertShow');
                        window.location.reload();
                    },1500);
                }
            });
        });
        $('.orderList_bot').off('click','.alreadyRemind').on('click','.alreadyRemind', function(e) {
            var evt = e || window.event; // 兼容IE
            evt.stopPropagation();       // 阻止事件冒泡
            $('.errAlert').addClass('AlertShow').text('今日已提醒，明日再试');
            setTimeout(function(){
                $('.errAlert').removeClass('AlertShow');
            },3000);
        });
    }

    //查看物流，未确认收货
    function lookORconfirm() {
        //点击查看物流按钮的事件，首先阻止事件冒泡   
        $('.orderList_bot').off('click','.delivery').on('click','.delivery', function(e) {
            var evt = e || window.event; // 兼容IE
            evt.stopPropagation();       // 阻止事件冒泡
            console.log("已经阻止事件冒泡");
            var cpy = $(this).parents(".orderList_box").find(".orderList_num").children('.input1').val();   // 物流公司
            var num = $(this).parents(".orderList_box").find(".orderList_num").children('.input2').val();   // 物流单号
            var callbackUrl = "http://a.91jfk.com/Product/Zero/allOrder.html";
            window.location.href = "http://a.91jfk.com/HomePublic/Common/search_express?type=" + cpy + "&postid=" + num + "&callbackurl=" + callbackUrl; 
        });
        //点击确认收货按钮的事件，首先阻止事件冒泡
        $('.orderList_bot').off('click','.confirmGet').on('click','.confirmGet', function(e) {
            var evt = e || window.event;    // 兼容IE
            evt.stopPropagation();          // 阻止时间冒泡
            var OdNum = $(this).parents(".orderList_box").find(".orderNum").text();
            console.log(OdNum);
            if (OdNum.substring(0,1) == 'Z') {
                $.ajax({
                    url:"http://a.91jfk.com/Product/Order/order_end",
                    type:"post",
                    data:{
                        orderid:OdNum
                    },
                    dataType:'json',
                    success:function(res){
                        console.log(res);
                        if (res.code == '1') {
                            $('.confirm_cancel').hide();
                            $('.mask').hide();
                            $('.errAlert').addClass('AlertShow').text(res.message);
                            setTimeout(function(){
                                $('.errAlert').removeClass('AlertShow');
                                window.location.reload();
                            },1500);
                        }
                    },
                    error:function(err){
                        console.log(err);
                    }
                });
            } else if(OdNum.substring(0,1) == 'J'){
                $.ajax({
                    url:"http://a.91jfk.com/Product/Ordershop/ConfirmReceipt",
                    type:"post",
                    data:{
                        orderid:OdNum
                    },
                    dataType:'json',
                    success:function(res){
                        $('.errAlert').addClass('AlertShow').text(res.message);
                        setTimeout(function(){
                            $('.errAlert').removeClass('AlertShow');
                            window.location.reload();
                        },1500);
                    },
                    error:function(err){
                        console.log(err);
                    }
                });
            }
        });
    }

    //查看物流，已确认收货
    function look() {
        //点击查看物流按钮的事件，首先阻止事件冒泡
        $('.orderList_bot').off('click','.signed').on('click','.signed', function(e) {
            var evt = e || window.event;    // 兼容IE
            evt.stopPropagation();          // 阻止事件冒泡
            console.log("已经阻止事件冒泡");
            var OdNum = $(this).parents(".orderList_box").find(".orderNum").text();
            console.log(OdNum);
        });
    }

    //申请退换货
    function return_goods(){
        //点击申请退货按钮的事件，首先阻止事件冒泡
        $('.orderList_con').off('click','.return_goods').on('click','.return_goods',function(e) {
            var evt = e || window.event;    // 兼容IE
            evt.stopPropagation();          // 阻止事件冒泡
            console.log("已经阻止事件冒泡");
            var OdNum = $(this).parents(".orderList_box").find(".orderNum").text();
            var bdNum = $(this).parents(".orderList_box").find(".branchid").text();
            console.log(OdNum,bdNum);
	        var storage = window.localStorage;
			var obj = {
				title,
				img,
				shuxingzhi,
				num,
				price,
				orderid,
				branchid,
				point
			}
			var img = $(this).parents(".orderList_con").find("img").attr("src");
			var shuxingzhi = $(this).parents(".orderList_con").find(".sucesORfail").text();
			var title = $(this).parents(".orderList_con").find(".goodTitle").text();
			var num = $(this).parents(".orderList_con").find(".count").children("m").text() - 0;
			var price = $(this).parents(".orderList_con").find(".price").children("m").text() - 0;
			var point = $(this).parents(".orderList_con").find(".price").children("n").text();
			var orderid = $(this).parents(".orderList_con").siblings(".orderList_num").find(".orderNum").text();
			var branchid = $(this).parents(".orderList_con").find(".branchid").text();
			obj.num = num;
			obj.price = price;
			obj.title = title;
			obj.shuxingzhi = shuxingzhi;
			obj.img = img;
			obj.orderid = orderid;
			obj.branchid = branchid;
			obj.point = point;
			storage.setItem("title", obj.title);
			storage.setItem("img", obj.img);
			storage.setItem("shuxingzhi", obj.shuxingzhi);
			storage.setItem("num", obj.num);
			storage.setItem("price", obj.price);
			storage.setItem("orderid", obj.orderid);
			storage.setItem("branchid", obj.branchid);
			storage.setItem("point", obj.point);
			window.location.href = "refund.html";
        });
    }

    //删除订单
    function deleteOrder(){
        $('.orderList_bot').off('click','.delete').on('click','.delete',function(e){
            var evt = e || window.event;    // 兼容IE
            evt.stopPropagation();          // 阻止事件冒泡
            var OdNum = $(this).parents(".orderList_box").find(".orderNum").text();
            console.log(OdNum);
            // 阻止弹窗出来以后还哦可以滚动
            $('.mask,.confirm_cancel').bind("touchmove", function(e) {
                e.preventDefault();
            });
            $('.mask').show();
            $('.confirm_cancel').show().find('.text').text('确认删除这笔订单吗？').siblings().children('.sure').unbind('click').bind('click',function(){
                $('.confirm_cancel').hide().find('.text').text('确认取消这笔订单吗？');     // 弹窗隐藏
                $('.mask').hide();       // 蒙版隐藏
                if (OdNum.substring(0,1) == 'Z') {
                    $.ajax({
                        url:"http://a.91jfk.com/Product/Order/order_del",
                        type:"post",
                        data:{
                            orderid:OdNum
                        },
                        dataType:'json',
                        success:function(res){
                            console.log(res);
                            if (res.code == '1') {
                                $('.confirm_cancel').hide();
                                $('.mask').hide();
                                $('.errAlert').addClass('AlertShow').text(res.msg);
                                setTimeout(function(){
                                    $('.errAlert').removeClass('AlertShow');
                                    window.location.reload();
                                },1500);
                            }
                        },
                        error:function(err){
                            console.log(err);
                        }
                    });
                } else if (OdNum.substring(0,1) == 'J'){
                    $.ajax({
                        url:"http://a.91jfk.com/Product/Ordershop/DeleteOrder",
                        type:"post",
                        data:{
                            orderid:OdNum
                        },
                        dataType:'json',
                        success:function(res){
                            $('.errAlert').addClass('AlertShow').text(res.message);
                            setTimeout(function(){
                                $('.errAlert').removeClass('AlertShow');
                                window.location.reload();
                            },1500);
                        },
                        error:function(err){
                            console.log(err);
                        }
                    });
                }
            });
        });
    }
    
    // 再次购买
    function secondBuy() {
        //点击再次购买按钮的事件，首先阻止事件冒泡   
        $('.orderList_bot').off('click','button.seeExpress.secondBuy').on('click','button.seeExpress.secondBuy', function(e) {
            var evt = e || window.event; //兼容IE
            evt.stopPropagation();
            var OdNum = $(this).parents(".orderList_box").children(".orderList_num").children(".orderNum").text();
            console.log(OdNum);
            var orderList_con = $(this).parents(".orderList_box").children(".orderList_con");
            var arr = [];
            if (OdNum.substring(0,1) == 'Z') {
                for(var i = 0;i < orderList_con.length;i++){
                    var obj = {};
                    obj.goodId = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.input1').val();
                    obj.goodSrc = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.img').attr('src');
                    obj.goodName = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.goodTitle').text();
                    obj.goodPrice = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.price').text();
                    obj.goodNum = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.count').text();
                    obj.totalPrice = $(this).prev().children('.allPrice').text();
                    obj.totalNum = $(this).prev().children('.good_piece').text();
                    arr.push(obj);
                    Number = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.count').text();
                    Id = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.input1').val();
                    $.ajax({  
                        url:'http://a.91jfk.com/Product/Zero/cart', 
                        type:'post',  
                        dataType:'json',
                        data:{  
                            id:Id,
                            num:Number.substring(1,Number.length)
                        },  
                        success:function(res) { 
                            console.log(res);
                        },  
                        error : function(err) {    
                            console.log(err);
                        }  
                    });//ajax结束
                }
                console.log(arr);
                localStorage.setItem('thisZero',JSON.stringify(arr));
                window.location.href = '/Product/Zero/confirmOrder_zero.html';
            } else if(OdNum.substring(0,1) == 'J'){
                var goodType = $(this).parents(".orderList_bot").children('.inputType').val();
                console.log(goodType);  // 1、纯现金  3、纯集分  2、集分加现金
                for(var i = 0;i < orderList_con.length;i++){
                    var obj = {};
                    obj.goodId = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.input1').val();
                    obj.skuId = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.input2').val();
                    obj.skuState = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.sucesORfail').text();
                    obj.goodSrc = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.img').attr('src');
                    obj.goodName = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.goodTitle').text();
                    obj.goodPrice = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.price').text();
                    obj.goodNum = $(this).parents(".orderList_box").children(".orderList_con").eq(i).find('.count').text();
                    obj.totalPrice = $(this).prev().children('.allPrice').text();
                    obj.totalNum = $(this).prev().children('.good_piece').text();
                    obj.goodType = $(this).parents(".orderList_bot").children('.inputType').val();
                    arr.push(obj);
                }
                console.log(arr);
                var a = JSON.stringify(arr);
                window.localStorage.setItem('thisPoint',a);
                switch(goodType){
                    case '1':
                        window.location.href = '/Product/Zero/confirmOrder_mall.html';
                        break;
                    case '2':
                        window.location.href = '/Product/Zero/confirmOrder_exchange.html';
                        break;
                    case '3':
                        window.location.href = '/Product/Zero/confirmOrder_exchange.html';
                        break;
                    default:break;
                }
            }
        });
    }

    // 点击取消按钮
    $('.cancel').bind('click', function() {
        $('html,body').removeClass('ovfHiden');
        $('.mask').hide();
        $('.confirm_cancel').hide();
    });

    // 关闭付款弹框
    $('.closePay').bind('click', function(event) {
        event.stopPropagation();
        window.location.reload();
        $('html,body').removeClass('ovfHiden');
        $('.mask').hide();
        $('.payment_foot').hide();
    });

    // 微信支付
    function callpay(arg) {
		if(typeof WeixinJSBridge == "undefined") {
			if(document.addEventListener) {
				document.addEventListener('WeixinJSBridgeReady', jsApiCall, false);
			} else if(document.attachEvent) {
				document.attachEvent('WeixinJSBridgeReady', jsApiCall);
				document.attachEvent('onWeixinJSBridgeReady', jsApiCall);
			}
		} else {
			jsApiCall(arg);
		}
	}

	// 调用微信JS api 支付
	function jsApiCall(arg) {
		var data = JSON.parse(arg);
		WeixinJSBridge.invoke(
			'getBrandWCPayRequest',
			data,
			function(res) {
				WeixinJSBridge.log(res.err_msg);
				if(res.err_msg == "get_brand_wcpay_request:ok") {
					//alert("支付成功");
                    window.location.reload();
				} else if(res.err_msg == "get_brand_wcpay_request:cancel") {
                    //alert("取消支付");
                    window.location.reload();
				} else {
					//alert(res.err_msg);
					//alert("支付失败");
				}
			});
	}
});